package com.service;

import com.dao.DonationDao;
import com.datasource.TargetDataSource;
import com.dto.DonationDTO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @author linyukun
 * @date 2022/10/8 10:53
 */
@Service
public class DonationServiceImpl {
    @Autowired
    private DonationDao donationDao;


     /**
       * 新增赠书信息
       * @author linyukun
       * @date 2022-10-08 11:00
     */
    public Integer addDonation(DonationDTO dto) {
        return donationDao.addDonation(dto);
    }

     /**
       *删除赠书信息
       * @author linyukun
       * @date 2022-10-08 11:00
     */
    public Integer delDonation(DonationDTO dto) {
        return donationDao.delDonation(dto);
    }


     /**
       * 修改赠书信息
       * @author linyukun
       * @date 2022-10-08 11:05
     */
    public Object updateDonation(DonationDTO dto) {
        return donationDao.updateDonation(dto);
    }

    /**
     * 获取赠书信息列表
     * @author linyukun
     * @date 2022-10-08 11:05
     */
    public Object getDonationList(DonationDTO dto) {
        PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
        return new PageInfo(donationDao.getDonationList(dto));
    }

    public Object getAllDonationDate() {
        return donationDao.getAllDonationDate();
    }
}
